package org.example.Server.controller.home;

import lombok.extern.slf4j.Slf4j;
import org.example.Server.model.home.NewReplyDTO;
import org.example.Server.model.home.Post;
import org.example.Server.model.home.TypeReplyVO;
import org.example.Server.service.home.HomeService;
import org.example.Server.utils.PageResult;
import org.example.Server.utils.ResultAPI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/youxich/home")
@Slf4j
// 随便修改一下
public class HomeController {
    @Autowired
    private HomeService homeService;

    /**
     * 获取参课人数排行前n门semester课堂的封面以及课堂id、课堂名称为前端提供轮播图以及相应课堂目录
     *
     * @return
     * @Param sem_cnt 获取浏览数前sem_cnt的相应数据
     */
    @GetMapping("picture")
    public ResultAPI getHomeSlider(@RequestParam(value = "sem_cnt", defaultValue = "5") int sem_cnt) {
        return homeService.getSlider(sem_cnt);
    }

    /**
     * 获取当前课程的教师id，教师姓名和教师照片
     *
     * @param course_id 课程id
     * @return
     */
    @GetMapping("courseteam")
    public ResultAPI getHomeCourseTeam(@RequestParam(value = "course_id") int course_id) {
        return homeService.getCourseTeam(course_id);
    }

    /**
     * 获取课程介绍
     *
     * @param course_id 课程id
     * @return
     */
    @GetMapping("courseintro")
    public ResultAPI getHomeCourseIntro(@RequestParam(value = "course_id") int course_id) {
        return homeService.getCourseIntro(course_id);
    }

    @GetMapping("diection")
    public ResultAPI getDirection() {
        return homeService.getDirection();
    }

    @GetMapping("data")
    public ResultAPI getData() {
        return homeService.getHomeData();
    }
}
